const AnchorService = require("../services/anchorService")

class AnchorController {
  // 主播审核
  async auditAnchor(req, res) {
    try {
      const { anchor_ids, is_pass } = req.body
      await AnchorService.auditAnchor(anchor_ids, is_pass)
      res.json({
        code: 0,
        data: "success",
        msg: "审核成功",
      })
    } catch (error) {
      res.status(500).json({
        code: 500,
        msg: error.message,
      })
    }
  }

  // 获取主播列表
  async getAnchorList(req, res) {
    try {
      const query = req.query
      const anchorList = await AnchorService.getAnchorList(query)
      res.json({
        code: 0,
        data: anchorList,
        msg: "获取成功",
      })
    } catch (error) {
      res.status(500).json({
        code: 500,
        msg: error.message,
      })
    }
  }

  // 主播登录
  async login(req, res) {
    try {
      const data = {
        token: "112233",
      }
      res.json({
        code: 0,
        data,
        msg: "获取成功",
      })
    } catch (error) {
      res.status(500).json({
        code: 500,
        msg: error.message,
      })
    }
  }
  // 获取主播个人信息
  async getInfo(req, res) {
    try {
      const data = {
        name: "张三",
      }
      res.json({
        code: 0,
        data,
        msg: "获取成功",
      })
    } catch (error) {
      res.status(500).json({
        code: 500,
        msg: error.message,
      })
    }
  }
  // 获取主播个人账号认证状态
  getAuthStatus(req, res) {
    const data = {
      // 1已认证未付款 -》付款页
      // 2已认证已付款 -》大厅
      // 0 未认证 -》认证页
      initAuthStatus: 2,
    }
    res.json({
      code: 0,
      data,
      msg: "获取成功",
    })
  }
}

module.exports = new AnchorController()
